<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
		  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:sf="http://www.springframework.org/tags/faces"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:c="http://java.sun.com/jstl/core"
  template="/WEB-INF/layouts/standard.xhtml">

  <ui:define name="menu">

  </ui:define>

  <ui:define name="content">
    <!-- INCLUDE CONTENT -->
    <h1 class="pageTitle">Welcome to the JAWP application</h1>

    <c:if test="${empty currentUser.name}">
      <h2>Login Required</h2>
      <span class="text">Please enter your login and password to
        enter in application.</span>

      <div class="section">
        <c:if test="${not empty param.login_error}">
          <div class="errors">
            Your login attempt was not successful, try again.<br />
            Reason:
            #{sessionScope.SPRING_SECURITY_LAST_EXCEPTION.message}
          </div>
        </c:if>
        <br />
      </div>

      <div class="section">
        <form name="log"
          action="${request.contextPath}/flow/loginProcess"
          method="post">

          <c:if test="${not empty param.login_error}">
            <c:set var="username"
              value="${sessionScope.SPRING_SECURITY_LAST_USERNAME}" />
          </c:if>

          <fieldset>
            <h:panelGrid border="0" columns="3">
              <h:outputText value="User :" />
              <h:inputText required="true" value="#{username}"
                id="j_username" name="j_username"
                requiredMessage="Please enter a login" maxlength="20" />
              <h:message for="j_username" styleClass="errlogin" size="6" />

              <h:outputText value="Password :" />
              <h:inputSecret required="true" name="j_password"
                id="j_password"
                requiredMessage="Please enter a password" />
              <h:message for="j_password" styleClass="errpassword" />
            </h:panelGrid>

            <br />

            <div class="field">
              <div class="label" id="ask">
                Don't ask for my password for two weeks: <input
                  type="checkbox" name="_spring_security_remember_me" />
              </div>
            </div>

            <br />

            <div class="buttonGroup">
              <input name="submit" type="submit" value="Login"
                title="keith/melbourne" />
            </div>
          </fieldset>
        </form>
      </div>


      <div class="section">
        <h:form>
          <h:commandLink class="label" action="lostpwd"
            value="password lost" title="password lost"/>

          <h:outputText value=" - " />

          <h:commandLink class="label" action="help" value="help" />
        </h:form>
      </div>

      <h:form>
        <div class="inscriptionBouton">
          <h:commandLink action="registry">
            <h:graphicImage value="../images/inscription.png"
              alt="Sign up" title="Sign up" />
          </h:commandLink>
        </div>
      </h:form>
    </c:if>
  </ui:define>
</ui:composition>
